package org.quarenden.demo.controller;

import org.quarenden.demo.dao.MicroServiceRepository;
import org.quarenden.demo.model.MicroService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class MicroServiceController {

    @Autowired
    private MicroServiceRepository microServiceRepository;

    @GetMapping("/{id}")
    public MicroService getMicroService(@PathVariable String id){
        return microServiceRepository.findOne(id);
    }

    @PostMapping("/saveMicroService")
    public String saveMicroService(@RequestBody MicroService microService){
        microServiceRepository.save(microService);
        return "0";
    }

}
